<template>
  <div>
  <p v-for="item in msg">{{ item.data() }}</p>
    <div>
      <button class="btn-primary" @click="getInfo">点我</button>
    </div>
    </div>
</template>
<script type="text/ecmascript-6">
    export default {
      data() {
        return {
          msg: ''
        }
        },
      methods:{
        getInfo(){
         /*  this.axios({
             headers: {'X-Requested-With': 'XMLHttpRequest'},
              method:'get',
              url:'api/alarm/getAlarmList.do',
             responseType:'json',
            }).then(function (response) {
              console.log(response);
              this.msg=response;
            }).catch(function (error) {
              console.log(error)
            })*/
          $.ajax({
            url:'http://localhost:8080/alarm/getAlarmList.do',
            type:'get',
           /* headers: {
              'Access-Control-Allow-Credentials' : true,
              'Access-Control-Allow-Origin':'*',
              'Access-Control-Allow-Methods':'GET',
              'Access-Control-Allow-Headers':'application/json',
            },*/
            dataType:'JSONP',
            responseType:'application/json',
            success:function (res) {
              console.log(res);
              this.msg=res;
            }
          })
        }
      }
    }
</script>
